package com.meaningful.design_pattern.chain_of_responsibility.validation;

public class MinValidatorHandler implements ValidationHandler{

    private final int min;

    public MinValidatorHandler(int min) {
        this.min = min;
    }

    @Override
    public void validate(Object value, ValidatorContext context) throws ValidatorException {
        if (value instanceof Integer intValue) {
            if (intValue < min) {
                context.appendError(String.format("%d小于%d", intValue, min));
            }
        }
    }

}
